<!DOCTYPE html>
<html>
    <head>
        <meta name="referrer" content="never">
    </head>
    <body>
        <script>
        (function () {
            function getRestoreURL(url) {
                if (url.indexOf(document.location.origin + '/errors/error.html') === 0) {
                    return url;
                }
         
                return '/errors/error.html?url=' + escape(url);
            }
         
            function postJSBridgeMessage(message) {
                var element = document.createElement('iframe');
			  	element.style.display = 'none';
			  	element.src = "zwsessionrestore://" + message;
			  	document.documentElement.appendChild(element);
			  	setTimeout(function() { document.documentElement.removeChild(element); }, 0);
            }
         
            var index = document.location.href.search("history");
            var sessionRestoreComponents = JSON.parse(unescape(document.location.href.substring(index + "history=".length)));
            var urlList = sessionRestoreComponents['history'];
            var currentPage = sessionRestoreComponents['currentPage'];

            history.replaceState({}, "", getRestoreURL(urlList[0]));
         
            for (var i = 1; i < urlList.length; i++) {
                history.pushState({}, '', getRestoreURL(urlList[i]));
            }

            history.go(currentPage);
         
            setTimeout(function () {
                postJSBridgeMessage("reload");
                    }, 0);
            }) ();
            </script>
    </body>
</html>
